using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using ExamServer.Entities;
using Microsoft.EntityFrameworkCore;

namespace ExamServer.Service
{
  public class viewUserHaveMenusRepository : IviewUserHaveMenusRepository
  {
    private readonly DbContext dbContext;

    public viewUserHaveMenusRepository(DbContext dbContext)
      {
      this.dbContext = dbContext;
    }

    ///实现根据用户编号查询所拥有的菜单列表
    public async Task<IEnumerable<viewUserHaveMenus>> GetMenusByUidAsync(Guid id)
    {
        var list = await Task.FromResult(dbContext.Set<viewUserHaveMenus>().Where(x=>x.UID==id));
        return list;

    }
  }
}